<?php

/**
 * This is the model class for table "sys_bonus_index".
 *
 * The followings are the available columns in table 'sys_bonus_index':
 * @property string $bonus_index_id
 * @property string $bonus_index_date
 * @property double $bonus_index_value
 * @property string $bonus_index_type
 */
class sys_bonus_index extends CActiveRecord {

    /**
     * Returns the static model of the specified AR class.
     * @return sys_bonus_index the static model class
     */
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'sys_bonus_index';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('bonus_index_value', 'numerical'),
            array('bonus_index_type', 'length', 'max' => 7),
            array('bonus_index_date', 'safe'),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('bonus_index_id, bonus_index_date, bonus_index_value, bonus_index_type', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'bonus_index_id' => 'Bonus Index',
            'bonus_index_date' => 'Bonus Index Date',
            'bonus_index_value' => 'Bonus Index Value',
            'bonus_index_type' => 'Bonus Index Type',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search() {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria = new CDbCriteria;

        $criteria->compare('bonus_index_id', $this->bonus_index_id, true);
        $criteria->compare('bonus_index_date', $this->bonus_index_date, true);
        $criteria->compare('bonus_index_value', $this->bonus_index_value);
        $criteria->compare('bonus_index_type', $this->bonus_index_type, true);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
        ));
    }

}